package com.graphe;


import java.io.Serializable;
import java.util.List;

public class Chemin implements Serializable{

	private static final long serialVersionUID = -6074011786182019397L;
	
	public static String DEFAULT = "defaut";
	int id;
	List<Segment> segments;
	String type = DEFAULT;

	public Chemin()
	{
		
	}
	public Chemin(int id, String type)
	{
		this.type = type;
	}
	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public List<Segment> getSegments() {
		return segments;
	}
	public void setSegments(List<Segment> segments) {
		this.segments = segments;
	}

	public String toString(){
		StringBuffer sb = new StringBuffer();
		sb.append("<route id=\"").append(id).append("\"");
		sb.append(" type=\""+ this.type +"\" ");
		sb.append(" >");
		for(Segment segment : segments)
			sb.append(segment.toString());
		sb.append("</route>");
		return sb.toString();
	}

	public String getType() {
		if(type != null)
			return type;
		else 
			return DEFAULT;
	}
	public void setType(String type) {
		this.type = type;
	}
}
